package ccrClasses.layer1.results;

import ccrClasses.ICcr;
import ccrClasses.layer2.DateTime;
import ccrClasses.layer2.Description;
import ccrClasses.layer2.Source;
import ccrClasses.layer2.Test;
import java.util.ArrayList;

public class Result implements ICcr {
	
	public static final String OPEN_TAG = "<Result>";

	public static final String CLOSE_TAG = "</Result>";
	
	private ArrayList<Test> tests;
	
	private DateTime dateTime;
	
	private Description description;
	
	private Source source;

	public Result(){
		super();
                tests = new ArrayList<Test>();
	}
	

	@Override
	public String constructCcrString() {
		String ccrResult = OPEN_TAG;

                for(Test t: tests){
                    ccrResult += t.constructCcrString();
                }
		
		if(dateTime != null){
			ccrResult += dateTime.constructCcrString();
		}
		
		if(description != null){
			ccrResult += description.constructCcrString();
		}
		
		if(source != null){
			ccrResult += source.constructCcrString();
		}
		
		ccrResult += CLOSE_TAG;
		return ccrResult;
	}

	/**
	 * @return the tests
	 */
	public ArrayList<Test> getTests() {
		return tests;
	}

	/**
	 * @param tests the tests to set
	 */
	public void setTest(ArrayList<Test> tests) {
		this.tests = tests;
	}

	/**
	 * @return the collectionDateTime
	 */
	public DateTime getDateTime() {
		return dateTime;
	}

	/**
	 * @param collectionDateTime the collectionDateTime to set
	 */
	public void setDateTime(DateTime collectionDateTime) {
		this.dateTime = collectionDateTime;
	}

	/**
	 * @return the description
	 */
	public Description getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(Description description) {
		this.description = description;
	}

	/**
	 * @return the source
	 */
	public Source getSource() {
		return source;
	}

	/**
	 * @param source the source to set
	 */
	public void setSource(Source source) {
		this.source = source;
	}

}
